<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .show {
            width: 200px;
            height: 200px;
            position: relative;
            margin: 0 auto;
            /* overflow: hidden; */
        }

        .mov {
            width: 200px;
            height: 200px;
            display: flex;
            position: absolute;
            right: 0;

        }

        .mov img {
            width: 200px;
            height: 200px;
        }

        .prev {
            width: 40px;
            height: 40px;
            position: absolute;
            left: 0;
            top: 80px;
            z-index: 1;
            color: gold;
            font-size: 32px;
            line-height: 40px;
            text-align: center;
        }

        .next {
            width: 40px;
            height: 40px;
            position: absolute;
            right: 0;
            top: 80px;
            z-index: 1;
            color: gold;
            font-size: 32px;
            line-height: 40px;
            text-align: center;
        }
    </style>
</head>

<body>
    <div class="show">
        <div class="mov">
            <img src="./img/mc1.jpg" alt="">
            <img src="./img/mc2.jpg" alt="">
            <img src="./img/mc3.jpg" alt="">
            <img src="./img/mc4.jpg" alt="">
            <img src="./img/mc1.jpg" alt="">
        </div>
        <div class="prev">
            < </div>
                <div class="next">></div>
        </div>
</body>
<script src="../day13/jquery-3.6.0.min.js"></script>
<script>



    var x = 0
    var timer
    lun()
    $(".prev").on("click", function () {
        clearInterval(timer)
        $(".mov").stop(false, true)
        x = x - 200
        bo()
        lun()
    })
    $(".next").on("click", function () {
        clearInterval(timer)
        $(".mov").stop(false, true)
        x = x + 200
        bo()
        lun()
    })
    function lun() {
        timer = setInterval(function () {
            x = x + 200
            bo()
        }, 2000)
    }
    function bo() {
        if (x > 600) {
            $(".mov").animate({ right: 800 }, 1000, function () {
                x = 0
                $(".mov").animate({ right: x }, 0, function () { })
            })
        } else {
            $(".mov").animate({ right: x }, 1000, function () { })
        }
    }


</script>

</html>